import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class GridNav extends StatefulWidget {
  GridNav({Key key, this.list}) : super(key:key);
  final List list;
  @override
  _GridNavState createState() => _GridNavState();
}

class _GridNavState extends State<GridNav> {
  List list;
  @override
  void initState() {
    list = widget.list;
    super.initState();
  }
  @override
  Widget build(BuildContext context) {
    ScreenUtil.init(context,width:750,height:1334);
    return SliverGrid(
      // shrinkWrap:true,
      gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
        crossAxisCount: 4,
        childAspectRatio: 1
      ),
      delegate: new SliverChildBuilderDelegate(
        (BuildContext context,int index){
          return Container(
            color: Colors.white,
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment:CrossAxisAlignment.center,
              children: <Widget>[
                ClipOval(
                  child: Image.network(
                    "https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2259614868,961155351&fm=26&gp=0.jpg",
                    width:ScreenUtil().setWidth(100),
                    height: ScreenUtil().setWidth(100),
                    fit: BoxFit.cover,
                  ),
                ),
                Container(
                  padding: EdgeInsets.only(top:ScreenUtil().setHeight(10)),
                  child: Text(list[index]),
                )
              ],
            ),
          );
        },
        childCount:list.length
      ),
      // itemCount:list.length,
      // itemBuilder: (context,index) {
      //   return 
      // }
    );
  }
}